const pino = require('pino');
const config = require('../config');

const logger = pino({
    level: config.LOG_LEVEL || 'info',
    base: undefined,
    timestamp: pino.stdTimeFunctions.isoTime,
});

function childWithReqId(reqId) {
    if (!reqId) return logger;
    return logger.child({ reqId });
}

module.exports = {
    logger,
    childWithReqId,
};


